<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>首页</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/lib/layui/css/layui.css">
</head>
<body>
    <div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<table id="financeTable" lay-filter="financeTable"></table>
			</div>
		</div>
	</div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/lib/layui/layui.all.js"></script>
<script>
var ctx = "${pageContext.request.contextPath}";
var typeDicDatas = eval('${typeDicDatas}');

function getDicVal(value,list){
	for(var i=0;i<list.length;i++){
		if(list[i].dicDataValue==value){
			return list[i].dicDataName;
		}
	}
	return "";
}

function getNowFormatDate() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = year  + month +  strDate;
    return currentdate;
}
$(function(){
	var laydate = layui.laydate;
	var laytable = layui.table;
	var layer = layui.layer;
	
	var tableIns = laytable.render({
	    elem: '#financeTable'
	    ,url: ctx+'/dataAnalyze/findByType' //数据接口
	    ,height:350
	    ,where: {
	    	ticketType: "", 
	    	startDate: getNowFormatDate(),
	    	endDate: getNowFormatDate()
	    }//参数
	    ,page: true //开启分页
	    ,cols: [[ //表头
	    	{field: 'dicDataName', title: '类型',templet: function(d){
		          return d.dicDataName;
		      }  }
		      ,{field: 'carTims', title: '车次',templet: function(d){
		          return d.carTims;
		      } } 
		      ,{field: 'weights', title: '重量',templet: function(d){
		          return d.weights;
		      } }
	      /* ,{field: 'unit', title: '操作',templet: function(d){
	          return "<button type='button' class='layui-btn layui-btn-sm layui-btn-normal' onClick='openLay("+d.dicDataValue+")'>详情</button>";
	      } } */
	    ]]
	  });
	/*$("#query_btn").on("click",function(){
		tableIns.reload({
		  where: { //设定异步数据接口的额外参数，任意设
			ticketType: $("#ticketType").val(), 
	    	startDate: $("#startDate").val(),
	    	endDate: $("#endDate").val(),
		  }
		  ,page: {
		    curr: 1 //重新从第 1 页开始
		  }
		});
	});*/
	
});


</script>
</html>